{-# LANGUAGE OverloadedStrings #-}

import Data.List
import System.Random
import Util
import Text.LaTeX
import Text.LaTeX.Base.Class
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Packages.Graphicx
import Text.LaTeX.Packages.Geometry

main :: IO ()
main = do
    printdoc $ doc $ mkStdGen 2

doc :: Monad m => StdGen -> LaTeXT_ m
doc g = do
    -- original piece written in Float -- conversions made to ensure random order is the same
    -- TODO: ensure random floats are cross-platform?
    mapM_ block $ zip (fmap realToFrac $ take 12 $ ((randoms g) :: [Float])) (fmap realToFrac $ take 12 $ drop 12 $ ((randoms g) :: [Float]))
    textblock' (vw 0.6) (vh 0.95) "at peace"

block (x, y) = textblock' (vw $ x) (vw y) $ texttt $ fromString $ foldr (++) "" $ intersperse " " $ replicate 240 "this is not happening"
